HiPassPulse : RipplePulse{

	createGuiControls{
		
		super.createGuiControls;
		
		this.put(\steps,  	c.new(default: 0.1, min: 0.1, max:8) );
		this.put(\hiPassFreq,  	c.new(default: 0, min: 40, max: 15000, theLog: 3, postLaunch: true) );
		
			this.put(\len, 			c.new(default: 0, midiNum:16, max:15) );
			this.put(\attack, 		c.new(default: 0.5, midiNum:17,max:15) );
			this.put(\decay, 			c.new(default: 0.5, midiNum:18,max:15) );
			this.put(\pulseAttack,  	c.new(default: 0.1, max:1) );
			this.put(\pulseDecay,  	c.new(default: 0.1, max:1) );
			this.put(\timescale,  	c.new(default: 1, min: 0.03, max: 8,  midiNum:14) );
		
		
	}
	
	*getCPUIndex{
		^1.3;
	}
	
	*playSound{|args, group, buffer, busNum|
		ArrayUtils.setValueInSynthArgs(args, \hiPassFreq, ArrayUtils.getValueFromSynthArgs(args, \hiPassFreq).max(40));
		
		Synth(this.getSynthName ++ "HPF", args, group);
		super.playSound(args, group, buffer, busNum);
	}

	
	*loadSynth{
		
		super.loadSynth;
		
		SynthDef(
			this.getSynthName ++ "HPF",
			{	
				arg hiPassFreq, busNum;
				var sig; 
				sig = In.ar(busNum, 2);
				sig = HPF.ar(sig, Lag.kr(hiPassFreq, 0.1));
				ReplaceOut.ar(busNum, sig);
			}).load(Server.default);
		
		
		/*
		
		SynthDef(
					
		this.getSynthName,
		//"LongHiPassPulse",
		{
				arg 
				len = 1, 
				startOffset = 0, 
				bufnum, 
				attack = 0.05, 
				decay = 0.05, 
				volume = 0.7,
				volume2 = 1, 
				tremeloFreq = 0, 
				tremeloDepth = 0,
				tremeloRand = 0,
				pan = 0,
				pitchRatio = 1,
				loopLength,
				pitchUp, 
				pitchDown,
				speed,
				steps = 2.5,
				pulseAttack,
				pulseDecay,
				curve,
				hiPassFreq,
				longCurve,
				busNum,
				r,
				swellGate,
				swellAmount = 1,
				swellEnv;
				
				var p, c, startFrames, endLoop, loopFrames, numChannels, maxLoopLength, amp;
				
				maxLoopLength = BufFrames.kr(bufnum);
				
				startFrames = maxLoopLength * startOffset; 
				
				loopFrames = loopLength * SynthConstants.getLoopResution;
				loopFrames = if( loopLength > 0.95, maxLoopLength, loopFrames );
				endLoop = (startFrames + loopFrames).min( BufFrames.kr(bufnum) );
				
				swellEnv = EnvGen.kr(Env.linen(3,0,3, 1), swellGate) * swellAmount;
				swellEnv = swellEnv + 1;
				
				p = LoopBuf.ar(
					2,
					bufnum, 
					BufRateScale.kr(bufnum) * pitchRatio * (pitchUp + 1) * (1 - pitchDown), 
					startPos: startFrames,
					startLoop: startFrames,
					endLoop: endLoop,
					gate:Impulse.kr(speed * swellEnv)) 
				* EnvGen.kr(Env.perc(pulseAttack / swellEnv, pulseDecay/ swellEnv, 1, curve ), gate: Impulse.kr(speed * swellEnv), doneAction: 0)
				* (SynthSugar.stepOsc(speed, steps.ceil) + 1);
				
				amp = Amplitude.kr(p, 0, 1);
				
				p = p / (0.01 + (amp * 20)); 
				
				p = if( BufChannels.kr(bufnum) > 1, 
					(
						Balance2.ar(
							HPF.ar(p[0], hiPassFreq), // left
							HPF.ar(p[1], hiPassFreq), // right
							pan
						)
					),
					(
						Pan2.ar(
							HPF.ar(p, hiPassFreq),
							pan // this is pan
						)	
					)
				  );
				  
				Out.ar(busNum, 
					p
				);
				
				
			}
			
		).load(Server.default);
		
		*/
	
	}

}

LongHiPassPulse : HiPassPulse{

		createGuiControls{
		
			super.createGuiControls;
			
			this.put(\len, 			c.new(default: 0, midiNum:16, max:15) );
			this.put(\attack, 		c.new(default: 0.5, midiNum:17,max:15) );
			this.put(\decay, 			c.new(default: 0.5, midiNum:18,max:15) );
			this.put(\pulseAttack,  	c.new(default: 0.1, max:1) );
			this.put(\pulseDecay,  	c.new(default: 0.1, max:1) );
			this.put(\timescale,  	c.new(default: 1, min: 0.03, max: 8,  midiNum:14) );
		
	}
}

FasterHiPassPulse : HiPassPulse {	createGuiControls{
		super.createGuiControls;
		this.put(\speed,  	c.new(default: 0.5, min: 1, max:200) );
			
	}
}
